package com.gzp.topic;

import javax.jms.JMSException;
import javax.jms.TextMessage;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jms.core.JmsTemplate;

/**
 * 主题的消费者
 * 
 * @author Administrator
 *
 */
public class TestTopicConsumer {

	@SuppressWarnings("resource")
	public static void main(String[] args) throws JMSException {
		ApplicationContext context = new ClassPathXmlApplicationContext("classpath:application-topic.xml");
		JmsTemplate jmsTemplate = context.getBean(JmsTemplate.class);
		TextMessage textMessage = (TextMessage) jmsTemplate.receive();
		System.out.println("消息接收成功，消息内容为：" + textMessage.getText());
	}
}
